<!DOCTYPE html>
<html lang="utf-8" class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <#include "/comm/module-index.ftl"/>
</head>
<#include "/comm/js_user_all.ftl">
<body>
<div class="layui-div-body">
    <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">内容管理</a>
            <a href="">文章管理</a>
            <a>
              <cite>文章类型管理</cite></a>
          </span>
    </div>
    <div class="layui-fluid layui-div-table">
        <div>
            <form class="layui-form" autocomplete="off" id="searchForm" lay-filter="searchForm">
                <div class="layui-inline layui-show-xs-block layui-input-wrap">
                    <input class="layui-input table-search-date" autocomplete="off" placeholder="开始日"
                           name="startDate" id="start">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <input class="layui-input table-search-date" autocomplete="off" placeholder="截止日" name="endDate"
                           id="end">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <input type="text" name="keyword" placeholder="关键字" autocomplete="off"
                           class="layui-input">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <button class="layui-btn  layui-btn-sm" lay-submit="" lay-filter="table-search"><i
                                class="layui-icon">&#xe615;</i></button>
                    <button class="layui-btn  layui-btn-sm layui-btn-primary" type="reset" id="btn-search-reset"><i
                                class="layui-icon">&#xe640;</i></button>
                </div>
            </form>
            <div class="common-btn-block">
                <@shiro code="gen:article:category:add">
                    <a class="layui-btn  layui-btn-sm" lay-on="add"><i
                                class="layui-icon  layui-icon-add-1"></i> 添加
                    </a>
                </@shiro>
                <@shiro code="gen:article:category:delete">
                    <a type="button" class="layui-btn  layui-btn-sm layui-btn-danger" lay-on="deletes">
                        <i class="layui-icon layui-icon-delete"></i> 删除
                    </a>
                </@shiro>
            </div>
        </div>
        <#-- table-->
        <div class="layui-table-body" style="flex: 1" id="layui-table-bar">
            <table class="layui-hide" lay-filter="layui-table-main" id="layui-table-main"></table>
        </div>

    </div>
</div>

<script type="text/html" id="myOperateBtn">
    {{#  if(d._status >-2){ }}
    <@shiro code="gen:article:category:edit">
        <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
    </@shiro>
    <@shiro code="gen:article:category:delete">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
    </@shiro>
    {{#  } }}
</script>
<script type="text/html" id="myStatusBtn">
    {{#  if(d._status==1){ }}
    <a class="layui-btn layui-btn-primary layui-border-green layui-btn-xs" <@shiro code="gen:article:category:status"> lay-event="disable"</@shiro>>
        启用
    </a>
    {{#  } else if(d._status==-1){ }}
    <a class="layui-btn layui-btn-primary layui-btn-xs" <@shiro code="gen:article:category:status"> lay-event="disable"</@shiro>>
        禁用
    </a>
    {{#  } else { }}
    <a class="layui-btn  layui-bg-orange layui-btn-xs ">{{ statusStr(d._status) }}</a>
    {{#  } }}
</script>
<script type="text/javascript">
    layui.use(['index', 'table'], function () {
        let laydate = layui.laydate;
        // 日期
        laydate.render({
            elem: '.table-search-date'
        });
        let tableBase = layui.index;
        tableBase.render({
            cols: [{
                type: 'checkbox',
                fixed: 'left'
            },
                {type: 'space', hide: true, field: "_id"},
                {type: 'numbers', title: "序号", fixed: 'left'},
                {field: 'code', title: '编码'},
                {field: 'name', title: '名称'},
                {field: 'sort', title: '排序'},
                {
                    field: 'creator', title: '创建者', templet: function (obj) {
                        return systemUserFormatter(obj.creator);
                    }
                },
                {field: 'createTime', title: '创建时间'},
                {title: '状态', field: '_status', toolbar: '#myStatusBtn', width: 50, align: 'center'},
                {fixed: 'right', title: '操作', toolbar: '#myOperateBtn', width: 130, align: 'center'}
            ],
            area: ['550px', '520px'],
            tree: {
                view: {
                    expandAllDefault: true
                }
            }
        })
    });

</script>
</body>
</html>